package day11.fanxingdemo;

 class Box {//用我这个类的时候可能就对于的是student类，teacher类，类比arrlist<student>
    private Object item;
    public Box() {}

    public Box(Object item) {
        this.item = item;
    }

    public Object getItem() {
        return item;
    }

    public void setItem(Object item) {
        this.item = item;
    }
}

public class fanxingdemo4{
    public static void main(String[] args) {
        Box box = new Box();
        box.setItem("Hello");
        String s = (String)box.getItem();  // 需要强制类型转换
        System.out.println(s);
        // 运行时错误
        box.setItem(123);  //
    }
}
